package com.hns.frame.mybatis;

/**
 * postgresql 方言
 * @author:Fisher
 * @email:zhuangcaijin@126.com
 * @version Revision 2.0.0
 */
public class PostgresqlDialect implements Dialect {

	@Override
	public boolean supportsLimit() {
		return true;
	}

	@Override
	public boolean supportsLimitOffset() {
		return true;
	}

	@Override
	public String getLimitString(String querySelect, boolean hasOffset,
			int start, int size) {
		// hasOffset always true
		if ( start > 0 ) {
			return querySelect + " OFFSET " + start + " LIMIT " + size;
		} else {
			return querySelect + " LIMIT " + size;
		}
	}

}
